package com.todo.biz.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author zhangwenxiang
 * @date 2024/3/13 20:03
 * @description
 */
@Getter
@AllArgsConstructor
public enum ExamineStatusEnum {

    AUTO_EXAMINING(1, "AUTO_EXAMINING", "自动化审核中"),
    AUTO_EXAMINE_FAILED(2, "AUTO_EXAMINE_FAILED", "自动化审核失败"),
    AUTO_EXAMINE_SUCCESS(3, "AUTO_EXAMINE_SUCCESS", "自动化审核成功"),
    MANUAL_EXAMINE_FAILED(4, "MANUAL_EXAMINE_FAILED", "人工审核失败"),
    MANUAL_EXAMINE_SUCCESS(5, "MANUAL_EXAMINE_SUCCESS", "人工审核成功"),
    ;

    private static Map<Integer, ExamineStatusEnum> typeMap = Arrays
            .stream(ExamineStatusEnum.values())
            .collect(Collectors.toMap(ExamineStatusEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static ExamineStatusEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
